home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / share / pyshared / liveusb / launcher.py < prev    next >
Encoding:
Python Source  |  2012-03-09  |  1.6 KB  |  50 lines

  1. # -*- coding: utf-8 -*-
  2. #
  3. # Copyright ┬⌐ 2012, Tails developers <tails@boum.org>
  4.  
  5. """
  6. A unified launcher for the most common LiveUSBCreator usecases
  7. """
  8.  
  9. from liveusb import LiveUSBLauncherInterface, _
  10. from PyQt4 import QtCore, QtGui
  11. import os
  12.  
  13. class LiveUSBLauncher(QtGui.QApplication):
  14.     """ Main application class """
  15.     def __init__(self, args):
  16.         QtGui.QApplication.__init__(self, args) 
  17.         self.mywindow = LiveUSBLauncherDialog(args)
  18.         self.mywindow.show()
  19.         self.exec_()
  20.  
  21. class LiveUSBLauncherDialog(QtGui.QDialog, LiveUSBLauncherInterface):
  22.     """ Our main dialog class """
  23.  
  24.     def __init__(self, args):
  25.         QtGui.QDialog.__init__(self)
  26.         self.args = args
  27.         self.setupUi(self)
  28.         self.connect_slots()
  29.  
  30.     def connect_slots(self):
  31.         self.connect(self.cloneInstallButton, QtCore.SIGNAL("clicked()"),
  32.                      self.run_clone_install)
  33.         self.connect(self.cloneUpgradeButton, QtCore.SIGNAL("clicked()"),
  34.                      self.run_clone_upgrade)
  35.         self.connect(self.upgradeFromIsoButton, QtCore.SIGNAL("clicked()"),
  36.                      self.run_upgrade_from_iso)
  37.  
  38.     def run_live_usb_creator(self, args):
  39.         args = ['liveusb-creator'] + args + self.args
  40.         os.execvp('liveusb-creator', args)
  41.  
  42.     def run_clone_install(self):
  43.         self.run_live_usb_creator([ '-u', '-n', '--clone', '-P', '-m', '-x' ])
  44.  
  45.     def run_clone_upgrade(self):
  46.         self.run_live_usb_creator([ '-u', '-n', '-x', '--clone' ])
  47.  
  48.     def run_upgrade_from_iso(self):
  49.         self.run_live_usb_creator([ '-u', '-n', '-x' ])
  50.